<div id="grid1" class="mini-datagrid" allowAlternating="true" showFooter="false" style="width:100%;height:30%;" url="/basic/constGroup"  idField="id" onselectionchanged="onSelectionChanged" >
	<div property="columns">            
		<div field="id" width="20" headerAlign="center" >选项组编号</div>
		<div field="name" width="120" headerAlign="center" >选项组名称</div>
		<div field="updated" width="120" headerAlign="center" dateFormat="yyyy-MM-dd HH:mm:ss">选项组名称</div>          
	</div>
</div>
<div class="mini-toolbar" style="padding:0px;margin:0px;border-bottom:0;width:100%;">
	<table style="width:100%;">
		<tr>
			<td style="width:100%;">
				<a class="mini-button" iconCls="icon-addnew" id="buttonAdd" onclick="newRow()" plain="true">增加选项值</a>
			</td>
		</tr>
	</table>
</div>
<div id="grid2" class="mini-datagrid" allowAlternating="true" showFooter="false" idField="id" style="width:100%;height:64%;" url="/basic/constValue" >
	<div property="columns">
		<div type="indexcolumn" headerAlign="center">编号</div>
		<div field="name" width="250" headerAlign="center">选项名称<input property="editor" class="mini-textbox" style="width:100%;"/></div>           
		<div field="val" width="100">选项值<input property="editor" name="val" class="mini-spinner" vtype="range:0,100" style="width:100%;"/></div>   
		<div field="gid" width="100">选项组编号</div>                               
		<div field="updated" width="100" headerAlign="center" dateFormat="yyyy-MM-dd">更新日期</div>
		<div name="action" width="120" headerAlign="center" align="center" renderer="onActionRenderer" cellStyle="padding:0;">操作</div>                
	</div>
</div>
<script type="text/javascript">
mini.parse();
var urlDel = "/basic/constDel";
var urlUpd = "/basic/constUpd?gid=0";
var grid = mini.get("grid2");
var grid1 = mini.get("grid1");
mini.get("buttonAdd").disable();
grid1.load();

function onSelectionChanged(e) {
	var gridSelection = e.sender;
	var record = gridSelection.getSelected();
	if (record) {
		if(record.updateFlg == 0){
			grid.hideColumn("action");
			mini.get("buttonAdd").disable();
		}else{
			grid.showColumn("action");
			mini.get("buttonAdd").enable();
		}
		urlUpd = "/basic/constUpd?gid=" + record.id;
		grid.load({gid:record.id});
	}
}
</script>